package com.bw.lib_mvi

import android.os.Bundle
import android.os.PersistableBundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity

abstract class BaseActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (getLayout() == -1) {
            setContentView(getRootLayout())
        } else {
            setContentView(getLayout())
        }
        initView()
        initData()
        initEvent()
    }

    protected open fun initView() {}
    protected open fun initData() {}
    protected open fun initEvent() {}
    abstract fun getRootLayout(): View
    protected open fun getLayout(layout: Int = -1): Int {
        return layout
    }
}